<template>
  <div class="ui_bindbank">
    <van-nav-bar title="绑定银行卡">
      <van-icon name="arrow-left" slot="left" color="#333" @click="back"></van-icon>
    </van-nav-bar>
    <div class="information">
      <div class="self_information">
        <span>个人信息</span>
        <input name="userName" type="text" placeholder="请输入姓名">
      </div>
      <div class="self_information_card">
        <span>身份证号</span>
        <input name="id" type="text" placeholder="请输入身份证号">
      </div>
    </div>
    
    <div class="bank bank1" @click="goToChooseCard">
      <div class="bank_one">
        <i class="iconfont icon-yinhang font_one"></i>
      </div>
      <div class="bank_two bank_tow1">请选择开户银行</div>
      <div class="bank_three">暂不支持信用卡</div>
      <div class="bank_fore"><i class="iconfont icon-unie61f"></i></div>
    </div>
    <div class="bank bank2">
      <div class="bank_one">
        <i class="iconfont icon-yinhangqia font_one"></i>
      </div>
      <div class="bank_two">
        <input
          type="text"
          placeholder="请输入银行卡号"
          onkeyup="value=value.replace(/[^\d]/g,'')"
          maxlength="19">
      </div>
    </div>
    <div class="bank">
      <div class="bank_one">
        <i class="iconfont icon-shouji1 font_one"></i>
      </div>
      <div class="bank_two">
        <input
          type="text"
          placeholder="请填写预留手机号"
          onkeyup="value=value.replace(/[^\d]/g,'')"
          v-model="mobileNo"
          maxlength="11">
      </div>
    </div>
    <div class="massage">
      请绑定账户本人的银行卡,目前仅支持绑定一张
    </div>
    <van-button class="success_buttom" :block="true" @click="gotToNext">下一步</van-button>
    <van-popup v-model="show" position="bottom">
      <span class="password">短信验证</span> <i class="iconfont icon-guanbi" @click="show=false"></i>
      <div class="validate_text" v-if="promptText"> 请点击获取验证码</div>
      <div class="validate_text" v-else> 已向尾号为{{promptTextFalse}}的手机发送短信验证码</div>
      <input name="validate" type="text" class="validate_input" placeholder="请输入验证码" maxlength="6" v-model="smsCode">
      <span class="validate_num">
        <SmsCode :mobileNo="mobileNo" :mobileNoIsValid="mobileNoIsValid"></SmsCode>
      </span>
      <div class="validate_buttom"  @click="massagesAlert">
        验证
      </div>
    </van-popup>
  </div>
</template>

<script>
  import SmsCode from '../../component/login/SmsCode.vue';

  export default {
    name: 'BindBank',
    components: { SmsCode },
    data() {
      return {
        show: false,
        smsCode: '',
        mobileNo: '',
        mobileNoIsValid: true,
        promptText: false,
        promptTextFalse: '',
      };
    },
    methods: {
      gotToNext() {
        // TODO 下一步
        this.show = true;
        console.log('下一步');
      },
      back() {
        this.$router.go(-1);
      },
      goToChooseCard() {
        this.$router.push('/choosecard');
      },
      massagesAlert() {
        this.$dialog.alert({
          title: '验证码正确',
        }).then(() => {
          // on close
          this.$dialog.confirm({
            title: '为了您的资金安全,请前往设置支付密码',
           confirmButtonText:'设置支付密码',
          }).then(() => {
            // on close
            this.$router.push('/setpaypassword');
          });
        });
      },
    }
  };
</script>

<style lang="less" scoped>
  .ui_bindbank {
    input{
         height:76px;
         border:none;
         outline:none;
       }
    .van-popup {
      height: 80%;
      width: 100%;
      .icon-guanbi {
        font-size: 32px;
        position: relative;
        left: 74%;
        color: #ccc;
      }
      .password {
        position: relative;
        margin-top: 30px;
        display: inline-block;
        margin-bottom: 50px;
        width: 265px;
        height: 50px;
        font-size: 36px;
        left: 50%;
        margin-left: -140px;
      }
      .validate_text {
        width: 92%;
        margin: auto;
        border-top: 1px solid #e1e1e1;
        height: 80px;
        line-height: 80px;
        font-size: 24px;
        color: #999999;
      }
      .validate_input {
        border: none;
        border-radius: unset;
        outline: none;
        font-size: 32px;
        text-align: center;
        width: 420px;
        margin-left: 60px;
        border-bottom: 1px solid #e1e1e1;
      }
      .validate_num {
        height: 70px;
        width: 250px;
        display: inline-block;
        padding-left: 30px;
      }
      .validate_buttom {
        width: 690px;
        height: 90px;
        border-radius: 45px;
        margin: 30px auto;
        background-color: #f7a427;
        color: #fff;
        line-height: 90px;
        text-align: center;
        font-size: 30px;
      }
    }
    .massage{
      margin-top:20px;
      padding-left:30px;
      color:#999;
    }
    .information {
      width: 750px;
      height: 185px;
      margin:30px 0px;
      background-color: #fff;
      span{
        margin-right:15px;
      }
      .self_information{
        border-bottom:1px solid #e1e1e1;
      }
      .self_information, .self_information_card {
        width: 720px;
        height: 90px;
        float: right;
        line-height: 90px;
        span{
          font-size:30px;
        }
        .self_information_one, .self_information_1 {
          width: 150px;
        }
        .self_information_two, .self_information_2 {
          width: 570px;
        }
        .self_information_one, .self_information_two, .self_information_1, .self_information_2 {
          float: right;
        }
        .self_information_one, .self_information_two {
          border-bottom: 1px solid #e1e1e1;
        }
      }
    }
    .success_buttom {
      background-color: #f7a427;
      margin: 30px auto;
      text-align: center;
      width: 700px;
      height: 90px;
      color: #fff;
      font-size: 36px;
      border-radius: 45px;
    }
  }

  .bank_border {
    border-top: 1px solid #e1e1e1;
  }
  .bank1,.bank2{
    border-bottom: 1px solid #e1e1e1;
  }
  .bank {
    height: 100px;
    background-color: #fff;
    line-height: 85px;
    padding-top:10px;
    .bank_one,
    .bank_two,
    .bank_three,
    .bank_fore {
      float: left;
    }
    .bank_one {
      margin-left: 30px;
      //   border: 1px solid #000;
      .font_one {
        font-size: 60px;
        color: #446cec;
      }
    }
    .bank_two {
      padding-left: 30px;
      font-size: 30px;
      input{
        margin: 0;
        padding: 0;
      }
    }
    .bank_three {
      font-size: 30px;
      margin-left: 140px;
      color: #999999;
    }
    .bank_fore {
      color: #999999;
      .icon-unie61f {
        font-size: 28px;
        margin-left: 10px;
      }
    }
    .van-popup {
      position: fixed;
      top: 50%;
      width: 100%;
      padding-top: 10%;
      padding-bottom: 10%;
      left: 50%;
      max-height: 100%;
      overflow-y: auto;
      background-color: #fff;
      -webkit-transition: .2s ease-out;
      transition: .2s ease-out;
      -webkit-overflow-scrolling: touch;
      -webkit-transform: translate3d(-50%, -50%, 0);
      transform: translate3d(-50%, -50%, 0);
    }

  }
</style>



